﻿#include "DateTimeTest.h"

using namespace SystemTool;
using namespace SystemTool::Clock;

int TestDateTime()
{
	try
	{
		/*DateTime t(2021, 2, 11, 8, 47, 24);

		time_t tValue = t.ToTime_t();

		std::cout << tValue << std::endl;

		std::string strLocalTime = t.ToString();

		std::cout << strLocalTime << std::endl;

		std::string strIsoTime = t.ToString(DATE_REGION_UTC);

		std::cout << strIsoTime << std::endl;*/

	/*	DateTime t(2021, 2, 11, 8, 47, 24);

		time_t tValue = t.ToTime_t();

		DateTime t0 = DateTime::FromTime_t(tValue);

		std::cout << t0.ToString() << std::endl;*/

		/*time_t tValue = DateTime::Now().ToTime_t();

		std::cout << tValue << std::endl;

		DateTime t0 = DateTime::FromTime_t(tValue);

		std::cout << t0.ToString(DATE_REGION_UTC) << std::endl;*/

		DateTime t1 = DateTime::Now();

		std::cout << t1.ToString() << std::endl;

		DateTime t2 = DateTime::FromString("2021-2-11 08:52:29");

		std::cout << t2.ToString() << std::endl;

		DateTime t3 = DateTime::FromString("20210211T085229", DATE_REGION_UTC);

		std::cout << t2.ToString() << std::endl;

		std::cout << t2.ToString(DATE_REGION_UTC) << std::endl;
	}
	catch (BSException& e)
	{
		std::cout << e.ErrorMsg() << std::endl;

		return -1;
	}

	return 0;
}
